﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class M4399Pay : PayBase {

	public class Direction
	{
		///横屏
		public const string landscape = "0";
		///竖屏
		public const string portrait = "1";
		///反向横屏
		public const string landscape_op = "8";
		///反向竖屏
		public const string portrait_op = "9";
	}

	public override void Init (params string[] key)
	{
		jo = new AndroidJavaObject ("com.m4399Pay.Main");
		jo.Call ("init", key[0], key[1], int.Parse(key[2]));
	}

	public override void Pay (string moneyAmount, string productName, string produceDesc, System.Action<bool> payCallBack)
	{
		jo.Call ("pay", moneyAmount, productName);
		this.payCallBack = payCallBack;
	}

	public override void OnPayResult (string result)
	{
		if ("0" == result) {
			TJLog ("TJSDK---支付成功");
			if (payCallBack != null) {
				payCallBack (true);
			}
		} else if ("1" == result) {
			TJLog ("TJSDK---支付失败");
			if (payCallBack != null) {
				payCallBack (false);
			}
		} else if ("-1" == result) {
			TJLog ("TJSDK---支付取消");
			if (payCallBack != null) {
				payCallBack (false);
			}
		}
	}
}
